<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%> 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript">

function searchFn() {
	var frm=document.frm01;
	frm.action = "PDT1020P2.do";
	frm.submit();
}
function pageing(page){
	var frm=document.frm01;
	frm.action = "PDT1020P2.do?page="+page;
	frm.submit();
	}
	
function useFn(empCode,empName,deptName){
	
 	if(confirm(empName+" : 님의 사원정보를 사용하시겠습니까?")){
 		
		opener.document.frm01.employeeCode.value=empCode;
		opener.document.frm01.employeeName.value=empName;
		opener.document.frm01.departmentName.value=deptName;
		self.close();
 	}
}

</script>
</head>
<body>
<form name="frm01" method="post">
	<center>
			<table border="1" rules="all" width="80%">
				<tr> 
					<td align="center">사원이름</td>
					<td colspan="5"><input type="text" name="employeeName" value="${name }">
									<input type="button" onclick="searchFn()" value="검색"> 
				</tr>
				<tr>
					<td align="center" >번호</td>
					<td align="center" >이름</td>
					<td align="center" >성별</td>
					<td align="center" >소속부서</td>
					<td align="center" >졸업일</td>
					<td align="center" ></td>
				</tr>
				<c:forEach var="empList" items="${searchList}">
				<tr>
					<td align="center"  >${empList.rowNum}</td>
					<td align="center" >${empList.employeeName}</td>
					<td align="center" >${empList.genderCodeName}</td>
					<td align="center" >${empList.departmentName}</td>
					<td align="center" >${empList.graduationDate}</td>
					<td align="center" >
					<input type="hidden" name="empCode" value="${empList.employeeCode}">
					<input type="hidden" name="empName" value="${empList.employeeName}">
					<input type="hidden" name="deptName" value="${empList.departmentName}">
					<input type="button" name="modify" onclick="useFn('${empList.employeeCode}','${empList.employeeName}','${empList.departmentName}')" value="사용">
					</td>
				</tr>
				</c:forEach>
				<tr>
					<td colspan="6" align="center">
						<c:forEach var="a" begin="${startpage}" end="${maxpage }">
							<c:if test="${a==page}">[${a }]</c:if>
							<c:if test="${a!=page}">
								<a onclick="pageing(${a})">${a }</a>&nbsp;</c:if>
						</c:forEach>
					</td>
				</tr>
			</table>
	</center>
	</form>
</body>
</html>